Back to course home
0% completed
Vote For New Content
Oracle Hard
Integer to English Words (hard)
Solution: Integer to English Words
Trapping Rain Water (hard)
Solution: Trapping Rain Water
First Missing Positive (hard)
Solution: First Missing Positive
Merge K Sorted Lists (hard)
Solution: Merge K Sorted Lists
Max Points on a Line (hard)
Solution: Max Points on a Line
Sudoku Solver (hard)
Solution: Sudoku Solver
Longest Valid Parentheses (hard)
Solution: Longest Valid Parentheses
Remove Nth Node From End of List (Medium)
Solution: Remove Nth Node From End of List
Median of Two Sorted Arrays (hard)
Solution: Median of Two Sorted Arrays
Constrained Subsequence Sum (hard)
Solution: Constrained Subsequence Sum
Single Element in a Sorted Array (medium)
Problem Statement
Given a sorted integer array nums in which each element appears exactly twice, and only 1 element appears exactly once, return the single element that appears only once.
Note: You must solve the problem in
Examples
-
Example 1:
- Input: nums =
[4,4,6,6,10,11,11] - Expected Output: 10
- Justification: Here, 10 is the only number that doesn't have a pair.
- Input: nums =
-
Example 2:
- Input: nums =
[1,1,2,3,3,4,4] - Expected Output: 2
- Justification: 2 is unique as it does not repeat, making it a single element.
- Input: nums =
-
Example 3:
- Input: nums =
[5,7,7,8,8,10,10] - Expected Output: 5
- Justification: 5 stands out as it's the only element without a duplicate in the sorted array.
- Input: nums =
Try it yourself
Try solving this question here:
Java
. . . .
Solution: Longest Palindromic Substring
Solution: Single Element in a Sorted Array
Mark as Completed
On this page
Problem Statement
Examples
Try it yourself